//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace Microsoft.Research.ScientificWorkflow.TridentModel
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// A denotation that the data parameter represents input
    /// to the workflow activity. Input parameters can either be
    /// marked as required or optional. Required input paramters
    /// must have a databinding set to an activity that sequences
    /// prior to the current activity in order to be valid.
    /// 
    /// The subclasses of InputParamAttribute provide alternate
    /// ways of writing the attribute. For instance:
    /// 
    /// [InputParam]
    /// [InputParam(false)]
    /// [OptionalInputParam]
    /// 
    /// are all equivalent. Similarly:
    /// 
    /// [InputParam(true)]
    /// [RequiredInputParam]
    /// 
    /// are also equivalent
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class InputParamAttribute : Attribute
    {
        private bool isRequired = false;

        /// <summary>
        /// Creates an optional input param
        /// </summary>
        public InputParamAttribute() : this(false) { }

        /// <summary>
        /// Allows the choice of required or optional when specifying
        /// an input param
        /// </summary>
        public InputParamAttribute(bool isRequired)
        {
            this.isRequired = isRequired;
        }

        /// <summary>
        /// When true, the activity is required to have a binding from
        /// an output parameter from another activity within the workflow
        /// </summary>
        public bool IsRequired
        {
            get { return isRequired; }
        }
    }
}
